<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href = "/tubu/Public/Css/common.css" type = "text/css" rel = "stylesheet"/>
<title>景区管理</title>
</head>
<body>
<div id="head">
	<div id="logo"> <img src="/tubu/Public/Img/logo.png" /></div>
	<div id="headguidance">
		<ul id="headnav">
		 
       	 <li><a href="/tubu/index.php/Admin/User/index">用户管理</a></li>
       	 <li><a href="/tubu/index.php/Admin/Scenic/index">景区管理</a></li>
       	 <li><a href="/tubu/index.php/Admin/Point/index">定点管理</a></li>
       	 <li><a href="/tubu/index.php/Admin/ScenicTicket/index">门票管理</a></li>
       	 <li><a href="/tubu/index.php/Admin/ScenicOrder/index">订单管理</a></li>
       	 <li><a href="/tubu/index.php/Admin/Publish/index">约吧管理</a></li>
       	 <li><a href="/tubu/index.php/Admin/Entertainment/index">娱乐管理</a></li>
		</ul>
	</div>
</div>
<div>
	<div id="userName">
			欢迎<?php echo ($_SESSION['username']); ?>管理员。<a href="/tubu/index.php/Admin/Login/logout">退出登录</a>
	</div>
	<div id="content">
		
<script type="text/javascript" src="/tubu/Public/Js/account_manage.js"></script>

<script type="text/javascript" src="/tubu/Public/Js/jquery-1.9.1.min.js"></script>

<script type="text/javascript" src="/tubu/Public/Js/jquery.fDialog.min.js"></script>

<script type="text/javascript" src="/tubu/Public/Js/fDialog.plugin.js"></script>

<script type="text/javascript" src="/tubu/Public/Js/ajaxfileupload.js"></script>

<link rel="stylesheet" href = "/tubu/Public/Css/fDialog.css">
<link rel="stylesheet" href = "/tubu/Public/Css/animate.css">
<link href = "/tubu/Public/Css/index.css" type = "text/css" rel = "stylesheet"/>
	<div id="content" align="center">		
		<div id="user" >
			<p style="margin-left:-560px; font-size:20px; color:#1d353f; font-weight:bold;">景区列表</p>
			<div id='addBtn'><input type="button" value="添加景区" id="btn" onclick="javascript:window.location.href = '/tubu/index.php/Admin/Scenic/add';"></div>
			<hr width="700px"/>
			<table>
			<tr style="color:#1d353f;"><th>序号</th><th>景区名字</th><th>景区图片<th>纬度</th><th>经度</th><th>操作</th><tr>
			<?php if(is_array($list)): foreach($list as $key=>$scenic): ?><tr>
				<td><?php if(($_GET['p'] == 0)): echo ++$i; else: echo ++$i + ($_GET['p']-1) * 7; endif; ?></td>
				<td><?php echo ($scenic['name']); ?></td>
				<td style="height: 100px"><img id="nowimg" name="nowimg" src="<?php echo ($scenic['image']); ?>" style="height: 100px;width: 100px"></td>
				<td><?php echo ($scenic['latitude']); ?></td>
				<td><?php echo ($scenic['longitude']); ?></td>
				<td>
					<a href="javascript:void(0)" onclick="javascript:test(this)" sid="<?php echo ($scenic['id']); ?>"><img  src="/tubu/Public/Img/edit.png"/></a>
					<a href="javascript:userDelete('/tubu/index.php/Admin/Scenic/delete','<?php echo ($scenic['id']); ?>')"><img src="/tubu/Public/Img/delete.png" /></a>
				</td>
			</tr><?php endforeach; endif; ?>	
			</table>
		</div>	
		<div id="count" align="center">共<?php echo ($count); ?>条</div>	
		<div id="page" align="center"><?php echo ($page); ?></div>	
	</div>

<script type="text/javascript">
var changeType = "<?php echo U('Scenic/change');?>"; 
	function test(dom){
		var url = "<?php echo U('Scenic/editType',array('sid'=>'###'));?>";
		var sid = dom.getAttribute('sid');
		url =url.replace("%23%23%23",sid);
 		$.fDialog({
			id : 'mydialog',
			title : '编辑景区类型', //标题
			content : url,
			buttons : ['保存','取消'],
			buttonClick : function(v,b,i,$f,t){
				if(i==0){
				change ();
					// var $iframe = $f.find('iframe').eq(0).contents();
    				// var scenicname = $iframe.find("#scenicName").val();
					// alert(scenicname);
					
				}
				else{
				    return true;
				}
			},
			module : 'ajax',
			animated : 'zoomIn', //入场动画效果CSS样式
			removeAnimated : 'zoomOut', //退场动画效果CSS样式
			w : "350px", //宽
			h : "450px", //高
			borderWidth : '5px', //设置边框大小
			initEnd : function($obj){
  				$obj.find('.fdialog-html').css('overflow','hidden');
			}
		});
}

	function change (){
		var scenicname = $("#scenicName").val();
		var str = "";
		if($("#shanshui").is(':checked')){
			str=str+"山水游";
		}
		if($("#gucun").is(':checked')){
			str=str+"古村游";
		}
		if($("#tehui").is(':checked')){
			str=str+"特惠游";
		}
		if($("#huodong").is(':checked')){
			str=str+"活动游";
		}
		
		 $.ajaxFileUpload
  			(
                {
                    url: changeType, //用于文件上传的服务器端请求地址
                    type: 'post',
                    data: { scenicname:scenicname,str:str }, //此参数非常严谨，写错一个引号都不行
                    secureuri: false, //一般设置为false
                    fileElementId: 'newimg', //文件上传空间的id属性  <input type="file" id="file" name="file" />
                    dataType: 'json', //返回值类型 一般设置为json
                    success: function (data, status)  //服务器成功响应处理函数
                    {
                       setTimeout('$("#type_cg").html("保存成功")', 1000 );
                       window.location.reload()
                      // $.fDialog('remove',"mydialog",true);

                    },
                    error: function (data, status, e)//服务器响应失败处理函数
                    {
                        setTimeout('$("#type_ts").html("保存失败")', 1000 );
                        //$.fDialog('remove',"mydialog",true);
                    }
                }
            ) 	
		}
</script>


	</div>
</div>
<!--<div id="foot">
	<div id="companyInfo">
		<p>名称：阡陌森创意设计有限公司&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;邮箱：qianmosen@163.com</p>
		<p>地址：浙江省温州市鹿城区府东路物华大厦6B &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;网址：http://www.arqm.cn</p>
	</div>
  <div id="copyright">
  	  <p>Copyright © 2014-2016 Arqm.Cn All Rights Reserved</p>
  </div>
</div>-->
</body>
</html>